<#include "macrosDisplay.ftl">
<#include "macroUtils.ftl">
<#include "macrosLoops.ftl">
<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="ext"%>
<%@ taglib uri="/tags/tps" prefix="tps"%>

<%
///Created ${util.getDateString()}
///$Id$
%>

<f:view>
	<html>
	<%@include file="/include/header.jsp" %>
		<div id="top">
			<%@include file="/include/topbar.jsp" %>
			<div id="buttonbar">
				<#-- New JSCookMenu based Menu Bar -->
				<ext:jscookMenu layout="hbr" theme="ThemeOffice" styleLocation="/css/jscookmenu">
		            <#-- Add Entity -->
					<ext:navigationMenuItem 
						rendered="<@hb>(globalHandler.superAdmin || globalHandler.access['entity.${bo.entityName}.add'])</@hb>" 
						icon="/img/blue/add.gif" 
						id="addEntity" 
						itemLabel="Add New" 
						action="<@hb><@boLow/>Handler.add</@hb>" />
		
		            <#-- Clone Entity -->
					<ext:navigationMenuItem 
						rendered="<@hb>(globalHandler.superAdmin || globalHandler.access['entity.${bo.entityName}.add']) and <@boLow/>Handler.selected</@hb>"
						icon="/img/blue/add.gif" 
						id="cloneEntity" 
						itemLabel="Clone" 
						action="<@hb><@boLow/>Handler.cloneEntity</@hb>" />
						
		            <#-- Add Existing Entity -->
					<ext:navigationMenuItem 
						rendered="<@hb>(globalHandler.superAdmin || globalHandler.access['entity.${bo.entityName}.add']) and <@boLow/>Handler.addExistingEnabled</@hb>"
						icon="/img/blue/add.gif" 
						id="addExistingEntities" 
						itemLabel="Add Existing" 
						action="<@hb><@boLow/>Handler.addExisting</@hb>" />
						
		            <#-- Edit Entity -->
					<ext:navigationMenuItem 
						rendered="<@hb>(globalHandler.superAdmin || globalHandler.access['entity.${bo.entityName}.edit']) and <@boLow/>Handler.selected</@hb>"
						icon="/img/blue/pencil.gif" 
						id="editEntity" 
						itemLabel="Edit" 
						action="<@hb><@boLow/>Handler.edit</@hb>" />
						
		            <#-- Delete Entity -->
		            <#-- TODO: Need onclick confirmation ~ 'onclick="if (!confirm('Are you sure?')) {return};"' -->
					<ext:navigationMenuItem 
						rendered="<@hb>(globalHandler.superAdmin || globalHandler.access['entity.${bo.entityName}.delete']) and <@boLow/>Handler.selected</@hb>"
						icon="/img/blue/delete.gif" 
						id="deleteEntity" 
						itemLabel="Delete"
						action="<@hb><@boLow/>Handler.delete</@hb>" />
		
		            <#-- Quick Edit -->
					<ext:navigationMenuItem 
						rendered="<@hb>(globalHandler.superAdmin || globalHandler.access['entity.${bo.entityName}.edit'])</@hb>"
						icon="/img/blue/application_cascade.gif" 
						id="quickEdit" 
						itemLabel="Quick Edit"
						action="<@hb><@boLow/>Handler.quickEdit</@hb>" />
						          
		            <#-- Filter On -->
					<ext:navigationMenuItem 
						rendered="<@hb>!<@boLow/>Handler.filterOn</@hb>"
						icon="/img/blue/cog_add.gif" 
						id="filterOn" 
						itemLabel="Filter On"
						action="<@hb><@boLow/>Handler.showFilter</@hb>" />
						
		            <#-- Filter Off -->
					<ext:navigationMenuItem 
						rendered="<@hb><@boLow/>Handler.filterOn</@hb>"
						icon="/img/blue/cog_delete.gif" 
						id="filterOff" 
						itemLabel="Filter Off"
						action="<@hb><@boLow/>Handler.hideFilter</@hb>" />
		            
		            <#-- Audit Off -->
					<ext:navigationMenuItem
						rendered="<@hb><@boLow/>Handler.showAuditLog</@hb>"
						icon="/img/blue/shield_delete.gif"
						id="auditToggleOff"
						itemLabel="Hide Audit Log"
						action="<@hb><@boLow/>Handler.toggleAuditLog</@hb>" />
					
					<#-- Audit On -->
					<ext:navigationMenuItem
						rendered="<@hb>!<@boLow/>Handler.showAuditLog</@hb>"
						icon="/img/blue/shield_add.gif"
						id="auditToggleOn"
						itemLabel="Show Audit Log"
						action="<@hb><@boLow/>Handler.toggleAuditLog</@hb>" />
						
		            <#-- Lock Entity -->
					<ext:navigationMenuItem
						rendered="<@hb>!<@boLow/>Handler.current.locked and <@boLow/>Handler.selected</@hb>"
						icon="/img/blue/lock_add.gif"
						id="lock"
						itemLabel="Lock"
						action="<@hb><@boLow/>Handler.lock</@hb>" />
					
					<#-- Unlock Entity -->
					<ext:navigationMenuItem
						rendered="<@hb>(<@boLow/>Handler.current.locked) and (<@boLow/>Handler.current.lockedBy == globalHandler.loginDisplay || globalHandler.superAdmin) and <@boLow/>Handler.selected</@hb>"
						icon="/img/blue/lock_open.gif"
						id="unlock"
						itemLabel="Unlock"
						action="<@hb><@boLow/>Handler.unlock</@hb>" />
		
					<#-- Direct Action Tasks :: render only if selected and not in edit mode -->
					<ext:navigationMenuItem 
						icon="/img/blue/wand.gif" 
						id="taskNav"
						itemLabel="Tasks"
						action="" 
						rendered="<@hb><@boLow/>Handler.selected and !<@boLow/>Handler.edit</@hb>" >
						<ext:navigationMenuItems value="<@hb><@boLow/>Handler.taskList</@hb>" />
					</ext:navigationMenuItem>
				</ext:jscookMenu>
			</div> <#-- Button Bar -->
		</div> <#-- Top Bar -->

		<div id="page">
		    <div id="tree">
				<%@include file="/include/tree.jsp" %>
			</div>
		
			<h:form style="margin-bottom: -1; margin:0;" <@multiPartEncode/>>
				<!-- List Elements -->
				<div id="content">
					
					<span class="errorList"><h:messages globalOnly="true" layout="list" errorClass="globalError" showSummary="true" showDetail="false" /></span>
					<h:outputText styleClass="list-title" value="<@hb><@boLow/>Handler.relationshipName</@hb>" rendered="<@hb>!<@boLow/>Handler.hideList</@hb>"/>
					<h:outputText styleClass="list-title" value="<@hb><@boLow/>Handler.current</@hb>" rendered="<@hb><@boLow/>Handler.hideList</@hb>"/>
			
					<h:panelGroup rendered="<@hb><@boLow/>Handler.filterOn</@hb>">
						<h:graphicImage style="margin-right: 3px; margin-left: 5px; vertical-align:middle;" height="16" width="16" value="/img/white/arrow_refresh.gif" />
						<h:commandLink styleClass="link" action="<@hb><@boLow/>Handler.showFilter</@hb>"><h:outputText value="Refresh Filter"/></h:commandLink>
					</h:panelGroup>
					
					<h:panelGroup rendered="<@hb>!<@boLow/>Handler.filterOn</@hb>">
			            <ext:popup
			                styleClass="popup"
			                closePopupOnExitingElement="true"
			                closePopupOnExitingPopup="true"
			                displayAtDistanceX="10"
			                displayAtDistanceY="10" >
			                <h:graphicImage style="margin-right: 3px; margin-left: 5px; vertical-align:middle;" height="16" width="16" value="/img/white/information.gif" />
			                <f:facet name="popup">
			                    <h:panelGroup>
			                        <h:panelGrid columns="1" >
			                        <h:outputText value="${bo.description?j_string}"/>
			                        </h:panelGrid>
			                    </h:panelGroup>
			                </f:facet>
			            </ext:popup>
					</h:panelGroup>
					
					<div id="list" style="padding-bottom: 20px; padding-top: 10px;">
						<h:panelGroup rendered="<@hb>!<@boLow/>Handler.hideList</@hb>">
							<f:verbatim><div class="round-list"></f:verbatim>
							<h:dataTable
							    rendered="<@hb>!<@boLow/>Handler.hideList</@hb>"
								value="<@hb><@boLow/>Handler.list</@hb>"
								var="list"
								styleClass="list-table"
								headerClass="list-th"
								rowClasses="list-tr"
								columnClasses="list-td">
								
								<#-- a status column for locked status and other (future) statuses -->
								<h:column>
									<f:facet name="header">
										<h:panelGroup>
											<h:graphicImage height="16" width="16" value="/img/gray/lock.gif" />
										</h:panelGroup>
									</f:facet>
						            <ext:popup
						                styleClass="popup"
						                closePopupOnExitingElement="true"
						                closePopupOnExitingPopup="true"
						                displayAtDistanceX="10"
						                displayAtDistanceY="10"
						                rendered="<@hb>not empty list.locked and list.locked</@hb>" >
										<h:graphicImage height="16" width="16" value="/img/white/lock.gif"/>
						                <f:facet name="popup">
						                    <h:panelGroup>
						                        <h:panelGrid columns="1" >
						                        <h:outputText value="Locked by <@hb>list.lockedBy</@hb>" />
						                        </h:panelGrid>
						                    </h:panelGroup>
						                </f:facet>
						            </ext:popup>
								</h:column>
								
								
								<@meLoop>
								<@isVisible member>
								<@isSummaryField member>
								<h:column>
									<#-- COLUMN HEADER GROUP -->
									<f:facet name="header">
										<h:panelGroup>
											<#if !util.isBeanPathMember(member)>
											<h:commandLink action="<@hb><@boLow/>Handler.setSortBy<@meCap/></@hb>" immediate="true">
												<h:outputText value="<@meDisplay/>" />
											</h:commandLink>
											<#else>
												<h:outputText value="<@meDisplay/>" />
											</#if>						
											<h:graphicImage height="16" width="16" value="/img/gray/arrow_up.gif" rendered="<@hb>(<@boLow/>Handler.sortColumn == '<@meLow/>') && <@boLow/>Handler.sortAscending</@hb>" />
											<h:graphicImage height="16" width="16" value="/img/gray/arrow_down.gif" rendered="<@hb>(<@boLow/>Handler.sortColumn == '<@meLow/>') && !<@boLow/>Handler.sortAscending</@hb>" />
											
											<#-- Filter Input Field :: Most attribute types handle a filter as a text-box, but some require special handling. -->
											<ext:div style="padding-top: 5px" rendered="<@hb><@boLow/>Handler.filterOn</@hb>">
												<#-- For Booleans -->
												<#if member.returnType = "java.lang.Boolean" >
												<h:selectOneRadio styleClass="detail-text" value="<@hb><@boLow/>Handler.example.<@meLow/></@hb>">
													<f:selectItem itemValue="True" itemLabel="True"/>
													<f:selectItem itemValue="False" itemLabel="False"/>
												</h:selectOneRadio>				

												<#-- For EnumMembers -->
												<#elseif member.class.name?ends_with("EnumMember") >
												<h:selectOneMenu styleClass="detail-text" value="<@hb><@boLow/>Handler.example.<@meLow/></@hb>">
													<tps:enumConverter enumClass="com.tps.gen.bo.${member.enumName}" />
													<f:selectItem itemValue="" itemLabel=""/>
													<#list member.enumeration.values as value><f:selectItem itemValue="${value.name}" itemLabel="${value.displayName?default(value.name)}"/>
													</#list>
												</h:selectOneMenu>
												
												<#-- For everyone else -->												
												<#else>
													<h:inputText styleClass="inputBox" size="8" value="<@hb><@boLow/>Handler.example.<@meLow/></@hb>" />
												</#if>
											</ext:div>
										
										</h:panelGroup>
									</f:facet>
									
									<#-- NON-QUICK EDIT START -->
									<h:commandLink action="<@hb><@boLow/>Handler.select</@hb>" immediate="true" rendered="<@hb>!<@boLow/>Handler.quickEdit</@hb>">
									 	<#if member.returnType = "com.tps.type.Document" >
										<tps:fileOutput value="<@hb>list.<@meLow/></@hb>" />
										
							 			<#-- Handle Output for Wiki Text -->						
									 	<#elseif member.returnType = "com.tps.type.WikiString" >
										<tps:wikiOutput value="<@hb>list.<@meLow/></@hb>" />
										
							 			<#-- Handle Output for Rich Text -->						
									 	<#elseif member.returnType = "com.tps.type.RichTextString" >
										<h:outputText escape="false" value="<@hb>list.<@meLow/></@hb>" />
										
										<#-- Handle Output For EnumMembers -->
										<#elseif member.class.name?ends_with("EnumMember") >
										<h:outputText escape="false" value="<@hb>list.<@meLow/>.displayName</@hb>" />
									
										<#else>
										<h:outputText value="<@hb>list.<@meLow/></@hb>" />
										</#if>
									</h:commandLink>
									
									<#-- QUICK EDIT START-->
								 	<h:panelGroup rendered="<@hb><@boLow/>Handler.quickEdit</@hb>">
											<#-- Only create edit boxes for non read-only, visible members -->
											<@isReadOnly member>
											 	<#if member.returnType = "com.tps.type.Document" >
												<tps:fileOutput value="<@hb>list.<@meLow/></@hb>" />
												<#else>
												<h:outputText value="<@hb>list.<@meLow/></@hb>" />
												</#if>
											</@isReadOnly>
						
											<@isNotReadOnly member>
											<#-- For Dates -->
											<#if member.returnType = "java.util.Date" >
											<ext:inputCalendar
													id="<@boLow/>_<@meLow/>"
													value="<@hb>list.<@meLow/></@hb>" renderAsPopup="true" required="<@meIsRequired/>"
													monthYearRowClass="yearMonthHeader" weekRowClass="weekHeader" currentDayCellClass="currentDayCell"/>
						
											<#-- For Address -->
											<#elseif member.returnType = "com.tps.type.Address" >
											<tps:addressInput id="<@boLow/>_<@meLow/>" value="<@hb>list.<@meLow/></@hb>"/>
						
											<#-- For Money -->
											<#elseif member.returnType = "com.tps.type.Money" >
											<h:inputText size="10" id="<@boLow/>_<@meLow/>" value="<@hb>list.<@meLow/></@hb>"/>
						
											<#-- For Documents -->
											<#elseif member.returnType = "com.tps.type.Document" >
											<tps:fileInput id="<@boLow/>_<@meLow/>" value="<@hb>list.<@meLow/></@hb>"/>
						
											<#-- For SSNs -->
											<#elseif member.returnType = "com.tps.type.SSN" >
											<h:inputText size="10" id="<@boLow/>_<@meLow/>" value="<@hb>list.<@meLow/></@hb>">
						                    	<f:validator validatorId="com.tps.validator.SSN"/>
											</h:inputText>
						
											<#-- For Booleans -->
											<#elseif member.returnType = "java.lang.Boolean" >
											<h:selectOneRadio styleClass="detail-text" id="<@boLow/>_<@meLow/>" value="<@hb>list.<@meLow/></@hb>">
												<f:selectItem itemValue="True" itemLabel="True"/>
												<f:selectItem itemValue="False" itemLabel="False"/>
											</h:selectOneRadio>				

											<#-- For EnumMembers -->
											<#elseif member.class.name?ends_with("EnumMember") >
											<h:selectOneMenu styleClass="detail-text" id="<@boLow/>_<@meLow/>" value="<@hb>list.<@meLow/></@hb>">
												<tps:enumConverter enumClass="com.tps.gen.bo.${member.enumName}" />
												<f:selectItem itemValue="" itemLabel=""/>
												<#list member.enumeration.values as value><f:selectItem itemValue="${value.name}" itemLabel="${value.displayName?default(value.name)}"/>
												</#list>
											</h:selectOneMenu>

											<#else>
											<#-- For Other Types -->
											<h:inputText size="10" id="<@boLow/>_<@meLow/>" value="<@hb>list.<@meLow/></@hb>">
											<@vaLoop>
												<@valid/>
											</@vaLoop>
											</h:inputText>
											</#if>
				
											<h:message styleClass="error" for="<@boLow/>_<@meLow/>"/>
											</@isNotReadOnly>
									</h:panelGroup>
								</h:column>
								</@isSummaryField>
								</@isVisible>
								</@meLoop>
							</h:dataTable>
							<f:verbatim></div></f:verbatim>
						</h:panelGroup>
				
						<#-- For Regular Paged List - NON QUICK EDIT MODE -->
						<ext:div styleClass="page-bar" rendered="<@hb>!<@boLow/>Handler.hideList && !<@boLow/>Handler.quickEdit</@hb>">
							<h:commandLink styleClass="link" action="<@hb><@boLow/>Handler.firstPage</@hb>"><h:graphicImage height="16" width="16" value="/img/white/resultset_first.gif" /></h:commandLink>
							<h:commandLink styleClass="link" action="<@hb><@boLow/>Handler.prevPage</@hb>"><h:graphicImage height="16" width="16" value="/img/white/resultset_previous.gif" /></h:commandLink>
							<h:outputText styleClass="page-text" value=" Page <@hb><@boLow/>Handler.page</@hb> of <@hb><@boLow/>Handler.totalPages</@hb> "/>
							<h:commandLink styleClass="link" action="<@hb><@boLow/>Handler.nextPage</@hb>"><h:graphicImage height="16" width="16" value="/img/white/resultset_next.gif" /></h:commandLink>
							<h:commandLink styleClass="link" action="<@hb><@boLow/>Handler.lastPage</@hb>"><h:graphicImage height="16" width="16" value="/img/white/resultset_last.gif" /></h:commandLink>
						</ext:div>
						
						<#-- FOR QUICK EDIT MODE -->
						<ext:div styleClass="page-bar" rendered="<@hb><@boLow/>Handler.quickEdit</@hb>">
							<h:commandLink styleClass="link-button" action="<@hb><@boLow/>Handler.saveQuickEdit</@hb>">
								<h:graphicImage height="16" width="16" value="/img/white/accept.gif"/><h:outputText value="Save"/>
							</h:commandLink>
							
							<h:commandLink styleClass="link-button" immediate="true" type="reset" action="<@hb><@boLow/>Handler.cancelQuickEdit</@hb>">
								<h:graphicImage height="16" width="16" value="/img/white/cancel.gif"/><h:outputText value="Cancel"/>
							</h:commandLink>
						</ext:div>
						</div> <#-- end list DIV -->
			
					<#-- FOR ADD EXISTING MODE -->
					<h:panelGroup rendered="<@hb><@boLow/>Handler.addExisting</@hb>">
						<f:verbatim><div class="round-detail"></f:verbatim>
						<h:panelGrid columns="2"
							styleClass="detail-table"
							headerClass="detail-header"
							footerClass="detail-footer"
							columnClasses="detail-th, detail-td"
							rowClasses="detail-tr">
				
							<f:facet name="header">
								<h:outputText value="Add Existing <@hb><@boLow/>Handler.handlerDisplayName</@hb>(s)"/>
							</f:facet>
				
							<h:outputText value="<@hb><@boLow/>Handler.handlerDisplayName</@hb>"/>
							<h:panelGroup>
								<h:selectManyListbox id="<@boLow/>_select" size="6" value="<@hb><@boLow/>Handler.selectedValues</@hb>">
									<f:selectItems value="<@hb><@boLow/>Handler.selectListValues</@hb>"/>
								</h:selectManyListbox>
				
								<h:message styleClass="error" for="<@boLow/>_select"/>
							</h:panelGroup>
				
							<f:facet name="footer">
								<f:verbatim>&nbsp;</f:verbatim>
							</f:facet>
							
						</h:panelGrid>
						<f:verbatim></div></f:verbatim>
						
						<ext:div styleClass="page-bar">
							<h:commandLink styleClass="link-button" immediate="true" type="reset" action="<@hb><@boLow/>Handler.cancel</@hb>">
								<h:graphicImage height="16" width="16" value="/img/white/cancel.gif" /><h:outputText value="Cancel"/>
							</h:commandLink>
				
							<h:commandLink styleClass="link-button" action="<@hb><@boLow/>Handler.save</@hb>">
								<h:graphicImage height="16" width="16" value="/img/white/application_edit.gif" /><h:outputText value="Save"/>
							</h:commandLink>
						</ext:div>
						
					</h:panelGroup>
					
					<#-- FOR REGULAR EDIT MODE -->
					<h:panelGroup rendered="<@hb><@boLow/>Handler.selected</@hb>">
						<f:verbatim><div id="round-detail"></f:verbatim>
						<h:panelGrid columns="2"
							styleClass="detail-table"
							headerClass="detail-header"
							footerClass="detail-footer"
							columnClasses="detail-th, detail-td"
							rowClasses="detail-tr"
							rendered="<@hb><@boLow/>Handler.selected</@hb>">
				
							<f:facet name="header">
								<h:panelGroup>
									<h:outputText value="<@hb><@boLow/>Handler.current</@hb>"/>
						            <ext:popup
						                styleClass="popup"
						                closePopupOnExitingElement="true"
						                closePopupOnExitingPopup="true"
						                displayAtDistanceX="10"
						                displayAtDistanceY="10"
						                rendered="<@hb>not empty <@boLow/>Handler.current.locked and <@boLow/>Handler.current.locked</@hb>" >
										<h:graphicImage style="margin-right: 3px; margin-left: 5px; vertical-align:middle;" height="16" width="16" value="/img/gray/lock.gif"/>
						                <f:facet name="popup">
						                    <h:panelGroup>
						                        <h:panelGrid columns="1" >
						                        <h:outputText value="Locked by <@hb><@boLow/>Handler.current.lockedBy</@hb>" />
						                        </h:panelGrid>
						                    </h:panelGroup>
						                </f:facet>
						            </ext:popup>
								</h:panelGroup>
							</f:facet>
				
							<@meLoop>
							<@isVisible member>
							<@isDetailField member>				
				
				            <ext:popup
				                styleClass="popup"
				                closePopupOnExitingElement="true"
				                closePopupOnExitingPopup="true"
				                displayAtDistanceX="0"
				                displayAtDistanceY="10">
						 	<h:outputLabel for="<@boLow/>_<@meLow/>" value="<@meDisplay/>" />
				                <f:facet name="popup">
						 	<h:panelGroup>
				                        <h:panelGrid columns="1" >
											<h:outputText value="${member.description}" />
				                        </h:panelGrid>
				                    </h:panelGroup>
				                </f:facet>
				            </ext:popup>
						 	
						 	<h:panelGroup>
						 	
						 			<#-- Handle Output for Files -->
								 	<#if member.returnType = "com.tps.type.Document" >
									<tps:fileOutput value="<@hb><@boLow/>Handler.current.<@meLow/></@hb>"
									<@isNotReadOnly member>
									rendered="<@hb>!<@boLow/>Handler.edit</@hb>"
									</@isNotReadOnly>
									/>
			
						 			<#-- Handle Output for Wiki Text -->						
								 	<#elseif member.returnType = "com.tps.type.WikiString" >
									<tps:wikiOutput value="<@hb><@boLow/>Handler.current.<@meLow/></@hb>" 
									<@isNotReadOnly member>
									rendered="<@hb>!<@boLow/>Handler.edit</@hb>"
									</@isNotReadOnly>	
									/>
									
						 			<#-- Handle Output for Rich Text -->						
								 	<#elseif member.returnType = "com.tps.type.RichTextString" >
									<h:outputText escape="false" value="<@hb><@boLow/>Handler.current.<@meLow/></@hb>" 
									<@isNotReadOnly member>
									rendered="<@hb>!<@boLow/>Handler.edit</@hb>"
									</@isNotReadOnly>	
									/>
									
									<#-- Handle Output For EnumMembers -->
									<#elseif member.class.name?ends_with("EnumMember") >
									<h:outputText escape="false" value="<@hb><@boLow/>Handler.current.<@meLow/>.displayName</@hb>" 
									<@isNotReadOnly member>
									rendered="<@hb>!<@boLow/>Handler.edit</@hb>"
									</@isNotReadOnly>	
									/>
									
						 			<#-- Handle Output for everything else -->
									<#else>
									<h:outputText value="<@hb><@boLow/>Handler.current.<@meLow/></@hb>" 
									<@isNotReadOnly member>
									rendered="<@hb>!<@boLow/>Handler.edit</@hb>"
									</@isNotReadOnly>	
									/>
									</#if>
									<#-- Only create edit boxes for non read-only, visible members -->
				
									<@isNotReadOnly member>
									<#-- For Dates -->
									<#if member.returnType = "java.util.Date" >
									<ext:inputCalendar
											id="<@boLow/>_<@meLow/>"
											rendered="<@hb><@boLow/>Handler.edit</@hb>"
											value="<@hb><@boLow/>Handler.current.<@meLow/></@hb>" renderAsPopup="true" required="<@meIsRequired/>"
											monthYearRowClass="yearMonthHeader" weekRowClass="weekHeader" currentDayCellClass="currentDayCell"/>
				
									<#-- For Address -->
									<#elseif member.returnType = "com.tps.type.Address" >
									<tps:addressInput id="<@boLow/>_<@meLow/>" value="<@hb><@boLow/>Handler.current.<@meLow/></@hb>" rendered="<@hb><@boLow/>Handler.edit</@hb>"/>
				
									<#-- For Money -->
									<#elseif member.returnType = "com.tps.type.Money" >
									<h:inputText id="<@boLow/>_<@meLow/>" value="<@hb><@boLow/>Handler.current.<@meLow/></@hb>" rendered="<@hb><@boLow/>Handler.edit</@hb>"/>
			
									<#-- For LongString -->
									<#elseif member.returnType = "com.tps.type.LongString" >
									<h:inputTextarea cols="40" rows="10" id="<@boLow/>_<@meLow/>" value="<@hb><@boLow/>Handler.current.<@meLow/></@hb>" rendered="<@hb><@boLow/>Handler.edit</@hb>"/>
			
									<#-- For WikiString -->
									<#elseif member.returnType = "com.tps.type.WikiString" >
									<h:inputTextarea cols="40" rows="10" id="<@boLow/>_<@meLow/>" value="<@hb><@boLow/>Handler.current.<@meLow/></@hb>" rendered="<@hb><@boLow/>Handler.edit</@hb>"/>
			
									<#-- For RichTextString -->
									<#elseif member.returnType = "com.tps.type.RichTextString" >
									<#if richtextinit?exists = false>
									<tps:js url="/js/tiny_mce/tiny_mce.js" rendered="<@hb><@boLow/>Handler.edit</@hb>"/>
									<tps:js url="/js/mceinit.js" rendered="<@hb><@boLow/>Handler.edit</@hb>"/>
									<#assign richtextinit = "init" />
									</#if>
									<h:inputTextarea styleClass="richtext" cols="80" rows="20" id="<@boLow/>_<@meLow/>" value="<@hb><@boLow/>Handler.current.<@meLow/></@hb>" rendered="<@hb><@boLow/>Handler.edit</@hb>"/>
																						
									<#-- For Documents -->
									<#elseif member.returnType = "com.tps.type.Document" >
									<tps:fileInput id="<@boLow/>_<@meLow/>" value="<@hb><@boLow/>Handler.current.<@meLow/></@hb>" rendered="<@hb><@boLow/>Handler.edit</@hb>"/>
				
									<#-- For SSNs -->
									<#elseif member.returnType = "com.tps.type.SSN" >
									<h:inputText id="<@boLow/>_<@meLow/>" value="<@hb><@boLow/>Handler.current.<@meLow/></@hb>" rendered="<@hb><@boLow/>Handler.edit</@hb>">
				                    	<f:validator validatorId="com.tps.validator.SSN"/>
									</h:inputText>
				
									<#-- For Booleans -->
									<#elseif member.returnType = "java.lang.Boolean" >
									<h:selectOneRadio styleClass="detail-text" id="<@boLow/>_<@meLow/>" value="<@hb><@boLow/>Handler.current.<@meLow/></@hb>" rendered="<@hb><@boLow/>Handler.edit</@hb>">
										<f:selectItem itemValue="True" itemLabel="True"/>
										<f:selectItem itemValue="False" itemLabel="False"/>
									</h:selectOneRadio>				

									<#-- For EnumMembers -->
									<#elseif member.class.name?ends_with("EnumMember") >
									<h:selectOneMenu styleClass="detail-text" id="<@boLow/>_<@meLow/>" value="<@hb><@boLow/>Handler.current.<@meLow/></@hb>" rendered="<@hb><@boLow/>Handler.edit</@hb>">
										<tps:enumConverter enumClass="com.tps.gen.bo.${member.enumName}" />
										<f:selectItem itemValue="" itemLabel=""/>
										<#list member.enumeration.values as value><f:selectItem itemValue="${value.name}" itemLabel="${value.displayName?default(value.name)}"/>
										</#list>
									</h:selectOneMenu>

									<#else>				
									<#-- For Other Types -->
									<h:inputText id="<@boLow/>_<@meLow/>" value="<@hb><@boLow/>Handler.current.<@meLow/></@hb>" rendered="<@hb><@boLow/>Handler.edit</@hb>">
									<@vaLoop>
										<@valid/>
									</@vaLoop>
									</h:inputText>
									</#if>
									<h:message styleClass="error" for="<@boLow/>_<@meLow/>"/>
									</@isNotReadOnly>
							</h:panelGroup>
							</@isDetailField>		
							</@isVisible>
							</@meLoop>
							
							<@MTMRelationshipsLoop>
							
							<@isInternalized relation>
							<@isSource bo,relation>
							<h:outputText value="${relation.display}" />
							
							<h:panelGroup>
								<h:dataTable
									rendered="<@hb>!<@boLow/>Handler.edit</@hb>"
									value="<@hb><@boLow/>Handler.<@uncap relation.aliasTarget/>s</@hb>"
									var="list"
									styleClass="inner-table"
									rowClasses="inner-tr"
									columnClasses="inner-td"
									>
									<h:column><h:outputText value="<@hb>list</@hb>" /></h:column>
								</h:dataTable>
						
								<h:selectManyListbox 
									id="<@boLow/>_<@uncap relation.aliasTarget/>" 
									size="6" 
									value="<@hb><@boLow/>Handler.selected<@cap relation.aliasTarget/>s</@hb>"
									rendered="<@hb><@boLow/>Handler.edit</@hb>">
									<f:selectItems value="<@hb><@boLow/>Handler.selectable<@cap relation.aliasTarget/>s</@hb>"/>
								</h:selectManyListbox>
								<h:message styleClass="error" for="<@boLow/>_<@uncap relation.aliasTarget/>" />
							</h:panelGroup>
						 	</@isSource>
							</@isInternalized>
							</@MTMRelationshipsLoop>
							
							<@MTORelationshipsLoop>
							
							<@isInternalized relation>
							<h:outputText value="${relation.display}" />
							
							<h:panelGroup>
								<h:dataTable
									rendered="<@hb>!<@boLow/>Handler.edit</@hb>"
									value="<@hb><@boLow/>Handler.<@uncap relation.aliasTarget/>s</@hb>"
									var="list"
									styleClass="inner-table"
									rowClasses="inner-tr"
									columnClasses="inner-td"
									>
									<h:column><h:outputText value="<@hb>list</@hb>" /></h:column>
								</h:dataTable>
						
								<h:selectOneListbox 
									id="<@boLow/>_<@uncap relation.aliasTarget/>" 
									size="1" 
									value="<@hb><@boLow/>Handler.selected<@cap relation.aliasTarget/></@hb>"
									rendered="<@hb><@boLow/>Handler.edit</@hb>">
									<f:selectItems value="<@hb><@boLow/>Handler.selectable<@cap relation.aliasTarget/>s</@hb>"/>
								</h:selectOneListbox>
								<h:message styleClass="error" for="<@boLow/>_<@uncap relation.aliasTarget/>" />
							</h:panelGroup>
			
							</@isInternalized>
							</@MTORelationshipsLoop>
							
							<#-- Audit Fields -->
							<h:outputLabel for="<@boLow/>_createdBy" value="Created By" rendered="<@hb>!<@boLow/>Handler.edit</@hb>"/>
							<h:outputText value="<@hb><@boLow/>Handler.current.createdBy</@hb>" rendered="<@hb>!<@boLow/>Handler.edit</@hb>"/>
							
							<h:outputLabel for="<@boLow/>_created" value="Created" rendered="<@hb>!<@boLow/>Handler.edit</@hb>"/>
							<h:outputText value="<@hb><@boLow/>Handler.current.created</@hb>" rendered="<@hb>!<@boLow/>Handler.edit</@hb>">
								<f:convertDateTime pattern="MMM dd, yyyy h:mm:ss aa zzz" timeZone="<@hb>preferenceHandler.preference.timeZone</@hb>"/>
							</h:outputText>
							
							<h:outputLabel for="<@boLow/>_modifiedBy" value="Last Modified By" rendered="<@hb>!<@boLow/>Handler.edit</@hb>"/>
							<h:outputText value="<@hb><@boLow/>Handler.current.modifiedBy</@hb>" rendered="<@hb>!<@boLow/>Handler.edit</@hb>"/>
							
							<h:outputLabel for="<@boLow/>_modified" value="Last Modified" rendered="<@hb>!<@boLow/>Handler.edit</@hb>"/>
							<h:outputText value="<@hb><@boLow/>Handler.current.modified</@hb>" rendered="<@hb>!<@boLow/>Handler.edit</@hb>">
								<f:convertDateTime pattern="MMM dd, yyyy h:mm:ss aa zzz" timeZone="<@hb>preferenceHandler.preference.timeZone</@hb>"/>
							</h:outputText>
							
							<f:facet name="footer">
								<h:panelGroup>
			
								</h:panelGroup>
							</f:facet>
						</h:panelGrid>
						<f:verbatim></div></f:verbatim>
						
						<#-- NORMAL BUTTON BAR -->
						<ext:div styleClass="page-bar">
							<h:commandLink styleClass="link-button" action="<@hb><@boLow/>Handler.edit</@hb>" rendered="<@hb>(globalHandler.superAdmin || globalHandler.access['entity.${bo.entityName}.edit']) and !<@boLow/>Handler.edit</@hb>">
								<h:graphicImage height="16" width="16" value="/img/white/pencil.gif" /><h:outputText value="Edit"/>
							</h:commandLink>
				
							<h:commandLink styleClass="link-button" action="<@hb><@boLow/>Handler.save</@hb>" rendered="<@hb><@boLow/>Handler.edit</@hb>">
								<h:graphicImage height="16" width="16" value="/img/white/accept.gif" /><h:outputText value="Save"/>
							</h:commandLink>
							
							<h:commandLink styleClass="link-button" action="<@hb><@boLow/>Handler.saveAndAddNew</@hb>" rendered="<@hb>(globalHandler.superAdmin || globalHandler.access['entity.${bo.entityName}.add']) and <@boLow/>Handler.edit && <@boLow/>Handler.new</@hb>">
								<h:graphicImage height="16" width="16" value="/img/white/accept.gif" /><h:outputText value="Save and Add New"/>
							</h:commandLink>
							
							<h:commandLink styleClass="link-button" action="<@hb><@boLow/>Handler.saveAndEditNext</@hb>" rendered="<@hb>(globalHandler.superAdmin || globalHandler.access['entity.${bo.entityName}.edit']) and <@boLow/>Handler.edit && !<@boLow/>Handler.new</@hb>">
								<h:graphicImage height="16" width="16" value="/img/white/accept.gif" /><h:outputText value="Save and Edit Next"/>
							</h:commandLink>
							
							<h:commandLink styleClass="link-button" immediate="true" type="reset" action="<@hb><@boLow/>Handler.cancel</@hb>" rendered="<@hb><@boLow/>Handler.edit</@hb>">
								<h:graphicImage height="16" width="16" value="/img/white/cancel.gif" /><h:outputText value="Cancel"/>
							</h:commandLink>
						</ext:div>
						
						<#-- Audit Log -->
						<h:panelGroup rendered="<@hb><@boLow/>Handler.showAuditLog</@hb>">
						<f:verbatim><br><br></f:verbatim>
						<f:verbatim><div class="round-list"></f:verbatim>
						<h:dataTable
							value="<@hb><@boLow/>Handler.auditLog</@hb>"
							var="audit"
							styleClass="list-table-no-highlite"
							headerClass="list-th"
							rowClasses="list-tr-nohighlite"
							columnClasses="list-td">
							
							<h:column>
								<f:facet name="header">
									<h:outputText value="Timestamp" />
								</f:facet>
								<h:outputText value="<@hb>audit.created</@hb>">
									<f:convertDateTime pattern="MMM dd, yyyy h:mm:ss aa zzz" timeZone="<@hb>preferenceHandler.preference.timeZone</@hb>"/>
								</h:outputText>
							</h:column>
							
							<h:column>
								<f:facet name="header">
									<h:outputText value="User" />
								</f:facet>
								<h:outputText value="<@hb>audit.username</@hb>" />
							</h:column>
							
							<h:column>
								<f:facet name="header">
									<h:outputText value="Action" />
								</f:facet>
								<h:outputText value="<@hb>audit.message</@hb>" />
							</h:column>
							
							<h:column>
								<f:facet name="header">
									<h:outputText value="Changed Values" />
								</f:facet>
								<h:dataTable
									value="<@hb>audit.auditLogPropertyRecords</@hb>"
									var="element"
									styleClass="audit-table"
									rowClasses="inner-tr"
									columnClasses="audit-th,audit-td"
									>
									<h:column rendered="<@hb>element.changed</@hb>"><h:outputText value="<@hb>element.property</@hb>" /></h:column>
									<h:column rendered="<@hb>element.changed</@hb>"><h:outputText value="<@hb>element.newValue</@hb>" /></h:column>						
								</h:dataTable>
							</h:column>
											
						</h:dataTable>
						<f:verbatim></div></f:verbatim>
						</h:panelGroup>
					</h:panelGroup>
				</div> <#-- content div -->
			</h:form>
		</div> <#-- page div -->
	<%@include file="/include/footer.jsp" %>
</f:view>
